/* 挂号订单模块，只包含当前操作订单的信息，不含历史订单等信息 */
import {
  SET_REG_SLICE,
  SET_REG_POINT,
  SET_REG_CARD,
  SET_CARD_REG_FEE,
  SET_REG_ORDER_NUM
} from '../mutation-types'

// initial state
const state = {
  // 订单ID
  id: -1,
  // 订单编号
  num: '',
  // 科室ID
  deptId: '',
  // 科室名称
  deptName: '',
  // 医生ID
  doctorId: '',
  // 医生名称
  doctorName: '',
  // 医生照片Url
  doctorPhotoUrl: '',
  // 挂号类型
  regType: '',
  // 挂号费
  regAmt: '',
  // 科目代码
  subjectId: '',
  // 科目名称
  subjectName: '',
  // 排班序号
  scheduleId: '',
  // 排班开始时间
  startTime: '',
  // 排班结束时间
  endTime: '',
  // 就诊卡ID
  cardId: -1,
  // 就诊卡号
  cardNum: '',
  // 就诊卡姓名
  cardName: '',
  // 就诊卡类型
  cardType: '',
  // 分时开始
  seqStartTime: '',
  // 分时结束
  seqEndTime: ''
}

// mutations
const mutations = {
  [SET_REG_SLICE] (state, deptId, deptName, doctorId, doctorName, doctorPhotoUrl, regType, regAmt, startTime, endTime, scheduleId,
    subjectId, subjectName) {
    state.deptId = deptId
    state.deptName = deptName
    state.doctorId = doctorId
    state.doctorName = doctorName
    state.doctorPhotoUrl = doctorPhotoUrl
    state.regType = regType
    state.regAmt = regAmt
    state.startTime = startTime
    state.endTime = endTime
    state.scheduleId = scheduleId
    state.subjectId = subjectId
    state.subjectName = subjectName
  },
  [SET_REG_POINT] (state, seqStartTime, seqEndTime) {
    state.seqStartTime = seqStartTime
    state.seqEndTime = seqEndTime
  },
  [SET_REG_CARD] (state, cardId, cardNum, cardName, cardType) {
    state.cardId = cardId
    state.cardNum = cardNum
    state.cardName = cardName
    state.cardType = cardType
  },
  [SET_CARD_REG_FEE] (state, regAmt) {
    state.regAmt = regAmt
  },
  [SET_REG_ORDER_NUM] (state, orderId, orderNum) {
    state.id = orderId
    state.num = orderNum
  }
}

export default {
  state,
  mutations
}
